<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
		<title>layout 后台大布局 - Layui</title>
		<link rel="stylesheet" href="res/layui/css/layui.css">
		<style>
			#refresh:hover {
				cursor: pointer;
			}
		</style>
	</head>
	<body class="layui-layout-body">
		<div class="layui-layout layui-layout-admin">
			<div class="layui-header">
				<div class="layui-logo">layui 后台布局</div>
				<!-- 头部区域（可配合layui已有的水平导航） -->
				<ul class="layui-nav layui-layout-left">
					<li class="layui-nav-item"><a href="">控制台</a></li>
					<li class="layui-nav-item"><a href="">商品管理</a></li>
					<li class="layui-nav-item"><a href="">用户</a></li>
					<li class="layui-nav-item">
						<a href="javascript:;">其它系统</a>
						<dl class="layui-nav-child">
							<dd><a href="">邮件管理</a></dd>
							<dd><a href="">消息管理</a></dd>
							<dd><a href="">授权管理</a></dd>
						</dl>
					</li>
				</ul>
				<ul class="layui-nav layui-layout-right">
					<li class="layui-nav-item">
						<a href="javascript:;">
							<img src="http://t.cn/RCzsdCq" class="layui-nav-img">
							贤心
						</a>
						<dl class="layui-nav-child">
							<dd><a href="">基本资料</a></dd>
							<dd><a href="">安全设置</a></dd>
						</dl>
					</li>
					<li class="layui-nav-item"><a id="logout" href="/login.html">退了</a></li>
				</ul>
			</div>

			<div class="layui-side layui-bg-black">
				<div class="layui-side-scroll">
					<!-- 左侧导航区域（可配合layui已有的垂直导航） -->
					<ul class="layui-nav layui-nav-tree" lay-filter="test">
						<li class="layui-nav-item layui-nav-itemed">
							<a class="" href="javascript:;">所有商品</a>
							<dl class="layui-nav-child">
								<dd><a href="javascript:;">列表一</a></dd>
								<dd><a href="javascript:;">列表二</a></dd>
								<dd><a href="javascript:;">列表三</a></dd>
								<dd><a href="">超链接</a></dd>
							</dl>
						</li>
						<li class="layui-nav-item">
							<a href="javascript:;">解决方案</a>
							<dl class="layui-nav-child">
								<dd><a href="javascript:;">列表一</a></dd>
								<dd><a href="javascript:;">列表二</a></dd>
								<dd><a href="">超链接</a></dd>
							</dl>
						</li>
						<li class="layui-nav-item">
							<a href="javascript:;">系统管理</a>
							<dl class="layui-nav-child">
								<dd><a href="javascript:;">字典数据</a></dd>
								<dd><a href="javascript:;">系统参数</a></dd>
							</dl>
						</li>
						<li class="layui-nav-item"><a href="">云市场</a></li>
						<li class="layui-nav-item"><a href="">发布商品</a></li>
						<li class="layui-nav-item"><a href="content-page/student-list.html">学生管理</a></li>
					</ul>
				</div>
			</div>

			<div class="layui-body">
				<div style="padding:0 15px; height: 99%;">
					<div class="heightRefer">
						<span class="layui-breadcrumb">
							<a href="/">首页</a>
							<!-- <a href="">国际新闻</a>
							<a href="">亚太地区</a> -->
							<a><cite id="currCite">正文</cite>
								<span currpage="content-test.html" id="refresh" class="layui-badge layui-bg-orange">刷新<i class="layui-icon layui-icon-refresh"></i></span>
							</a>
						</span>
					</div>

					<iframe src="content-test.html" frameborder="0" id="myiframe" style="width: 100%; height: 800px;"></iframe>
				</div>
			</div>

			<div class="layui-footer">
				<!-- 底部固定区域 -->
				© layui.com - 底部固定区域
			</div>
		</div>
		<script src="res/jquery/jquery.min.js"></script>
		<script src="res/layui/layui.js"></script>
		<script src="res/js/public.js"></script>
		<script src="res/js/sessionStorageCheck.js"></script>
		<script src="res/js/ajax-hook.js"></script>
		<script>
			//JavaScript代码区域
			layui.use(['element', 'layer'], function() {
				var element = layui.element,
					layer = layui.layer;
				// layer.msg('1');

				//iframe高度初始化
				initMyIframeHeight();

				//监听浏览器窗口变化
				$(window).resize(function() {
					initMyIframeHeight();
				});

				$('#myiframe').attr('src', $('#refresh').attr('currpage') + '?t=' + new Date().getTime()); //去缓存
				//导航列表超链接点击跳转
				$('.layui-side .layui-nav-item a').click(function() {
					var aimPage = $(this).attr('href');
					if (aimPage) {
						$('#currCite').text($(this).text()); //面包屑当前文本
						$('#refresh').attr('currpage', aimPage);
						$('#myiframe').attr('src', aimPage + '?t=' + new Date().getTime()); //iframe跳转  
					}
					return false; //阻止超链接跳转
				});

				//iframe刷新
				$('#refresh').click(function() {
					$('#myiframe').attr('src', $('#refresh').attr('currpage') + '?t=' + new Date().getTime());
				});

				//退出·注销
				$('a#logout').click(function() {
					sendAjax('/api/logout', 'GET', null, function(){
						layer.msg('注销成功！', {
							icon: 1,
							time: 1500 //2秒关闭（如果不配置，默认是3秒）
						}, function() {
							sessionStorage.removeItem(Manage_Login_Session);
							window.top.location.href = '/login.html'; 
						});
					});
					return false; //阻止超链接跳转
				});

				function initMyIframeHeight() {
					var referHeight = 0,
						parentHeight = 0,
						offsetHeght = 5;
					$('.heightRefer').each(function() {
						referHeight += $(this).height();
					});
					var parentHeight = $('.heightRefer').parent().height();
					$('#myiframe').height(parentHeight - referHeight);
				}
			});
		</script>
	</body>
</html>
